package com.AAA.controller.fpa;

import com.AAA.entity.LayData;
import com.AAA.entity.MyPage;
import com.AAA.entity.fpa.TFpaRecord;
import com.AAA.entity.fpa.TjMessage;
import com.AAA.entity.sas.TSasRecordjieguo;
import com.AAA.entity.sas.TSasRecordren;
import com.AAA.service.fpa.TFpaRecordService;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * (TFpaRecord)表控制层
 *
 * @author 何泽明
 * @since 2022-11-05 17:00:39
 */
@RestController
@RequestMapping("tFpaRecord")
public class TFpaRecordController {
    /**
     * 服务对象
     */
    @Autowired
    private TFpaRecordService service;

    /**
     * 查询所有的做题记录
     * @return
     */
    @GetMapping
    public LayData getData(MyPage myPage, TFpaRecord record){
        return new LayData(service.getAll(myPage,record));
    }

    @GetMapping("{id}")
    public LayData getDetailData(@PathVariable Integer id, MyPage myPage){
        return new LayData(service.getDetailMsg(id,myPage));
    }

    @GetMapping("checkUser")
    public LayData checkUser(TFpaRecord record){
        return new LayData(service.checkRecord(record));
    }

    @PostMapping("addRecord")
    public LayData addRecord(TFpaRecord record){
        return new LayData(service.insertRecord(record));
    }

    @GetMapping("tj")
    public LayData getTongji(){
        return new LayData(service.getTjData());
    }
    @GetMapping("tj2")
    public LayData getTongji2(MyPage myPage, TjMessage tjMessage){
        return new LayData(service.getTjData2(myPage,tjMessage));
    }
}

